package com.javasvip.serviceemail.service.impl;

import com.javasvip.common.pojo.service.EmailService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;

/**
 * dubbo rpc调用服务类
 */
@Service
public class EmailServiceimpl implements EmailService {
    @Autowired
    private JavaMailSender mailSender;

    @Override
    public Integer findDefaultResumeByUserId(Long userId) {
        System.out.println("111111111111=============");
        return 1000;
    }

    @Override
    public Integer sendMail(String email, String code) {
        System.out.println("发送邮件=====" + email + "==" + code);
        /*  mailService.sendMail("email","您的验证码是："+code);*/
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("jr-zywqd01@jybdshop.cn");
        message.setTo(email);
        message.setSubject("主题：");
        message.setText("测试" + code);

        mailSender.send(message);
        return 1;
    }
}
